import use_case.handlereturns.Storage;
import use_case.processRental.Checkout;
import use_case.processRental.Sale;
import junit.framework.TestCase;


public class SaleTest extends TestCase {

	private Sale sale;
	private Storage inventory;
	private Checkout cart;
	
	   public SaleTest(String name) {
	      super(name);
	   }
	   protected void setUp(){
		   inventory = new Storage();
		   inventory.initialize();
		   sale = new Sale(inventory);
		
	   }
	   
	   protected void tearDown(){
		   sale = null;
		   inventory = null;
		
	   }
	   
	   public void testAddItem(){
		   setUp();
		   double expected = sale.getCheckout().getCartSize() + 1;
		   sale.addItem(1);
		   assertTrue(sale.getCheckout().getCartSize() == expected);
		   tearDown();
	   }
	   
	   
	   public void testRemoveItemFromCart(){
		   setUp();
		   sale.addItem(0);
		   sale.addItem(1);
		   sale.addItem(2);
		   int expected = 2;
		   sale.removeItemFromCart(0);
		   assertEquals(expected, sale.getCheckout().getCartSize());
		   tearDown();
	   }
	   
	   public void testGetSelectedList(){
		   setUp();
		   sale.addItem(0);
		   sale.addItem(1);
		   String[] selectionList = sale.getSelectedList();
		   String expected = "A-Team" + "\t" + "$1.0";
		   assertEquals(expected, selectionList[0]);
		   tearDown();
	   }
}
